<body style='width:100%; text-align:center'>
<textarea id='input' style='width:100%;height:45%;'>
</textarea>
<script language='javascript'>
function smaller(text){
    document.getElementById("output").value = text.replace(/^\s*/mgi,"").replace(/\s*\n/mgi,"");
}
function jsExpander(text){
try{
     var outText = text;
     outText = outText.replace(/;/mgi,";\n").replace(/}(?!,|\)|;)/mgi,"}\n").replace(/{(?!})/mgi,"{\n").replace(/(?=.*)\/\*/mgi,"\n/*").replace(/\*\/(?=.*)/mgi,"*/\n").replace(/\n\n/mgi,"\n")
     
     
     
     document.getElementById("output").value = outText;
}catch(e){alert(e)}
}
</script>
<button onclick='smaller(document.getElementById("input").value)'>Collapse</button>
<button onclick='jsExpander(document.getElementById("input").value)'>Expand JS</button>
<textarea id='output' style='width:100%;height:45%;'>
</textarea>
</body>